package com.changpay.zywy.adapter

import android.content.Context
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.changpay.zywy.R
import com.changpay.zywy.bean.BankCardBean

/**
 * Created by chenxz on 2018/4/22.
 */
class BankCardAdapter(private val context: Context?, datas: MutableList<BankCardBean>) :
    BaseQuickAdapter<BankCardBean, BaseViewHolder>(R.layout.item_bank_card, datas) {

    override fun convert(helper: BaseViewHolder?, item: BankCardBean?) {
        item ?: return
        helper ?: return
        item.bank_card.let {
            val substring = it?.substring(it.length - 4, it.length)
            helper.setText(R.id.tv_card_number, "**** **** **** $substring")
        }
        helper.setText(R.id.tv_bank_name, item.bank_name).setText(R.id.tv_bank_card_type, item.bank_type)
    }

}
